package com.ruoyi.xsc.api.factory;


import com.ruoyi.xsc.api.RemoteCheerService;
import com.ruoyi.xsc.api.RemoteGasCheerTypeService;
import com.ruoyi.xsc.api.domain.Cheer;
import com.ruoyi.xsc.api.domain.GasCheerType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * 加油站服务降级处理
 * 
 * @author ruoyi
 */
@Component
public class RemoteGasCheerTypeFallbackFactory implements FallbackFactory<RemoteGasCheerTypeService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteGasCheerTypeFallbackFactory.class);

    @Override
    public RemoteGasCheerTypeService create(Throwable throwable)
    {
        log.error("加油站服务调用失败:{}", throwable.getMessage());
        return new RemoteGasCheerTypeService()
        {

            @Override
            public List<GasCheerType> getList(String source) {
                return new ArrayList<>();
            }
        };
    }
}
